package fhjoanneum.itm11.antesk.simplehack;

public class Tile
{
	// Members -----------------------------------------------------------
	private Character character;
	private Item item;
	private Event event;
	private String test;
	private Tile neighbor[] = new Tile[4];
		
	// Constructors ------------------------------------------------------
	public Tile()
	{
		setTest(" ");
		setCharacter(null);
		setEvent(null);
	}
	
	public Tile(Character character)
	{
		setCharacter(character);
	}
	
	public Tile(Item item)
	{
		setItem(item);
	}
	
	public Tile(Event event)
	{
		setEvent(event);
	}
	
	// Methods ===========================================================
	
	// Getters and Setters -----------------------------------------------
	public String getTest(){return this.test;}
	public void setTest(String test){this.test = test;}
	public Character getCharacter(){return this.character;}
	public void setCharacter(Character character){
		this.character = character;}
	public Item getItem(){return item;}
	public void setItem(Item item){this.item = item;}
	public Event getEvent(){return event;}
	public void setEvent(Event event){this.event = event;}

	// -------------------------------------------------------------------
	public Tile getNeighbor(Direction direction)
	{
		switch(direction)
		{
		case NORTH:
			return this.neighbor[0];
		case SOUTH:
			return this.neighbor[1];
		case EAST:
			return this.neighbor[2];
		case WEST:
			return this.neighbor[3];
		default:
			return null;
		}
	}
	
	// -------------------------------------------------------------------
	public void setNeighbor(Tile neighbor, Direction direction)
	{
		switch(direction)
		{
		case NORTH:
			this.neighbor[0] = neighbor;
			break;
		case SOUTH:
			this.neighbor[1] = neighbor;
			break;
		case EAST:
			this.neighbor[2] = neighbor;
			break;
		case WEST:
			this.neighbor[3] = neighbor;
			break;
		}
	}
	
	// Checks if entry is possible ---------------------------------------
	public boolean isEntryPossible()
	{
		if(this.character == null)
		{
			return true;
		}
		else
		{
			return false;
		}
	}
	
	// -------------------------------------------------------------------
	public TileType getTileType()
	{
		return TileType.TILE;
	}
}
